package com.zzb.projectfactory.config;

import com.zzb.projectfactory.controller.admin.interceptor.WebAdminInterceptor;
import com.zzb.projectfactory.controller.interceptor.UserMenuInterceptor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableAutoConfiguration

public class WebConfig extends WebMvcConfigurerAdapter {

  	@Bean
	public WebAdminInterceptor webAdminInterceptor(){
		return new WebAdminInterceptor();
	}
	@Bean
	public UserMenuInterceptor userMenuInterceptor(){return new UserMenuInterceptor();}
    @Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(webAdminInterceptor());
		registry.addInterceptor(userMenuInterceptor());
	}

}
